import { http } from '@/utils/request'

// 商品列表
export function getTicketGoodsList(query: any) {
  return http.request({
    url: `/small/ticketGoods/selectTicketGoodsList`,
    method: 'GET',
    params: query
  })
}

// 商品样式
export function getTicketGoodsStyle() {
  return http.request({
    url: `/small/ticketGoods/selectTicketGoodsStyle`,
    method: 'GET'
  })
}

// 商品详情
export function getTicketGoodsDetail(goodsId: number | string) {
  return http.request({
    url: `/small/ticketGoods/selectTicketGoodsDetail/${goodsId}`,
    method: 'GET'
  })
}

// 创建商品订单
export function createTicketGoodsOrder(data: any) {
  return http.request({
    url: `/small/ticketGoods/createTicketGoodsOrder`,
    method: 'POST',
    data
  })
}

// 我的订单列表
export function getMyTicketGoodsOrderList(data: any) {
  return http.request({
    url: `/small/ticketGoods/selectMyTicketGoodsOrderList`,
    method: 'GET',
    params: data
  })
}

// 我的订单详情
export function getMyTicketGoodsOrderDetail(orderId: number | string) {
  return http.request({
    url: `/small/ticketGoods/selectMyTicketGoodsOrderDetail/${orderId}`,
    method: 'GET'
  })
}

// 售后订单详情
export function selectMyTicketGoodsRefundOrderDetail(orderRefundId: number | string) {
  return http.request({
    url: `/small/ticketGoods/selectMyTicketGoodsRefundOrderDetail/${orderRefundId}`,
    method: 'GET'
  })
}

// 支付订单
export function payTicketGoods(orderId: number | string) {
  return http.request({
    url: `/small/ticketGoods/payTicketGoods/${orderId}`,
    method: 'GET'
  })
}

// 完成收货
export function finishTicketGoodsOrder(orderId: number | string) {
  return http.request({
    url: `/small/ticketGoods/finishTicketGoodsOrder/${orderId}`,
    method: 'POST'
  })
}

// 取消订单
export function cancelTicketGoodsOrder(data: any) {
  return http.request({
    url: `/small/ticketGoods/cancelTicketGoodsOrder`,
    method: 'POST',
    data
  })
}

// 删除订单
export function delTicketGoodsOrder(orderId: any) {
  return http.request({
    url: `/small/ticketGoods/deleteTicketGoodsOrder/${orderId}`,
    method: 'POST'
  })
}

// 申请退款
export function applyTicketGoodsOrderRefund(data: any) {
  return http.request({
    url: `/small/ticketGoods/applyTicketGoodsOrderRefund`,
    method: 'POST',
    data
  })
}
